#ifndef KBORDERBUTTON_H
#define KBORDERBUTTON_H

#include "../screencapsdk_global.h"
#include <QWidget>
#include <QPushButton>
#include <QIcon>
#include <QEvent>

namespace kdk
{

/** @defgroup PushbuttonModule
  * @{
  */

class KBorderButtonPrivate;

/**
 * @brief 带边框的按钮
 */
class SCREENCAPSDK_EXPORT KBorderButton:public QPushButton
{
    Q_OBJECT
public:
    KBorderButton(QWidget* parent = nullptr);
    KBorderButton(const QString &text, QWidget *parent = nullptr);
    KBorderButton(const QIcon &icon, const QString &text, QWidget *parent = nullptr);
    KBorderButton(const QIcon &icon, QWidget *parent = nullptr);

    /**
     * @brief 设置按钮图标
     * @param icon
     */
    void setIcon(const QIcon &icon);
    ~KBorderButton();

protected:
    bool eventFilter(QObject *watched, QEvent *event);
    void paintEvent(QPaintEvent *event);
    QSize sizeHint() const override;

private:
    Q_DECLARE_PRIVATE(KBorderButton)
    KBorderButtonPrivate * const d_ptr;
};
}
/**
  * @example testPushbutton/widget.h
  * @example testPushbutton/widget.cpp
  * @}
  */
#endif

